var vm;
$(function () {
	$("#startDate").val("2018-03-01 10:00:00");
	$("#endDate").val("2018-04-01 10:00:00");
	vm = new Vue({
        el: '#autoTender',
        data: {
            tabsShow:true,
            detail:false,
            add:false,
            clicktag:0,//防重复提交
            userCode:'7f9810bb',
            startDate:'',
            endDate:''
        },
        methods: {
        	queryAutoTenderRecord:function(){
        		console.log("click button");
        		vm.reload();
        	},
        	reload:function(){
        		console.log(this.$refs.startDate.value);
        		//vm.query.startDate = this.$refs.startDate.value
        		$("#jqGrid").setGridParam({
                    postData: {
                    	userCode	: this.userCode
                    },
                    page:1
                }).trigger("reloadGrid");
        	}
        }
    });
	
	$("#jqGrid").jqGrid({
        url: '../switch_card/list_records',
        
        postData: {
        	userCode	: vm.userCode
        },
        
        datatype: "json",
        colModel: [
            {label: '银行卡变更ID', name: 'orderNo'},
            {label: '变更时间', name: 'createTime'},
            {label: '变更前', name: 'before'},
            {label: '变更后', name: 'after' }
        ],
        viewrecords: true,
        height: 500,
        rowNum: 10,
        rowList: [10, 30, 50],
        rownumbers: true,
        rownumWidth: 25,
        autowidth: true,
        multiselect: false,
        pager: "#jqGridPager",
        jsonReader: {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",//总页数
            records: "page.totalCount"
        },
        prmNames: {
            page: "page",
            rows: "limit",
            order: "order"
        },
        gridComplete: function () {
            //隐藏grid底部滚动条
            $("#jqGrid").closest(".ui-jqGrid-bdiv").css({"overflow-x": "hidden"});
            $("#jqGridDetail").jqGrid("setGridWidth",$(window).width());
        }
    });
	//vm.queryAutoTenderRecord();
});

